<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>css_index</title>
    <script type="text/javascript" src="/public/js/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="/public/js/bootstrap.min.js"></script>


    <link href="/public/css/bootstrap.min.css" rel="stylesheet">
    <link href="/public/css/bootstrap-responsive.min.css" rel="stylesheet">
</head>

<body>
<div class="container" style="width:560px; margin-top: 100px;">

    <div id="another" style="height:54px; display:block;"></div>

    <div id="error" class="alert alert-error" style="margin-left: 29px; width:350px; display:none;">
        <strong>用户名或密码错误！</strong>
    </div>

    <form class="well form-horizontal span4" >
        <fieldset>
            <legend>登录</legend>
            <div class="control-group" style="margin-left: -50px;">
                <label for="user" class="control-label">用户名：</label>
                <div class="controls">
                    <input type="text" id="user" name="user" placeholder="用户名" class="input-large">
                </div>
            </div>

            <div class="control-group" style="margin-left: -50px;">
                <label for="pwd" class="control-label">密码：</label>
                <div class="controls">
                    <input type="password" id="pwd" name="password" placeholder="密码" class="input-large">
                </div>
            </div>

            <legend></legend>

            <div>
                <button class="btn btn-primary pull-right" style="margin-right: 40px;" id="button" type="button">登录 </button>
            </div>
        </fieldset>
    </form>

</div>

<script>
    $('#button').click(function() {
        var user = $('#user').val();
        var pwd  = $('#pwd').val();

        $.ajax({
            type : "post",
            url  : "/admin.php/login/op_login",
            data : 'user='+ user + '&pwd' + pwd,
            async : false,
            dataType: "json",
            success : function(data){
                if (data == 2) {
                    $("#error").show();
                    $("#another").css('display','none');
                }
            }
        });


    });

</script>
</body>
</html>
